//
//  ViewController.m
//  PhyloHunter
//
//  Created by Sean Bramhall on 2013-06-07.
//
//	Programmer(s): Sean Bramhall
//	Team Name: The Gigglers (Group 14)
//
//	Changes:
/*		June 21
		- Added the Credits button and linked it to its appropriate View Controller
 
		June 18
		- While not directly part of this page, added the App Icon
 
		June 12
		- Update the Background Image, so that the PhyloHunter title was more visible, by adding a White Outlining around the letters
 
		June 11
		- Updated the Background Image to a leafy background and a raccoon
 */
//	Bugs: N/A
//
//	Task:	Is the View Controller for the 'Main Menu' where you have the Three Feature buttons and the Credits button.

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    //load the unlocked array of cards from file
    NSMutableArray *cardTest;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *arrayPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"arrays.out"];
    cardTest = [NSArray arrayWithContentsOfFile:arrayPath];
    
    //if there are less than 30 cards, we consider the file to be invalid and create a new file
    if ([cardTest count]<30) {
        cardTest = [[NSMutableArray alloc] initWithObjects:@"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", @"Locked", nil];
        
        //save the new array to the arrays.out file
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *arrayPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"arrays.out"];
        [cardTest writeToFile:arrayPath atomically:(YES)];
        
    }
    

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
